<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .base {
            width: 200px;
            border: 1px solid #acacac;
        }

        .danger {
            color: #f00;
        }
    </style>
</head>
<body>
    <main id="app">
        <div :class="classObj">我是div</div>
        <button @click="handleClick">点击我</button>
    </main>
</body>
<script src="../vue.js"></script>
<script>
    let vue = new Vue({
        el: "#app",
        data: {
            classObj: {
                base: true,
                danger: false
            }
        },
        methods: {
            handleClick() {
                this.classObj.danger = !this.classObj.danger;
            }
        }
    })

    // vue.$mount("#app");
</script>
</html>